﻿using System;
using System.Collections.Generic;
using LuaInterface;

namespace Urbania.GUI
{
    public class LuaVM
    {
        protected Lua luaVM;

        public Lua LuaVirtual { get { return this.luaVM; } }

        public LuaVM()
        {
            luaVM = new Lua();
        }

        /// <summary>
        /// Registers a function with the lua VM
        /// EG: ("Refill", Soda, Soda.GetType().GetMethod("RefillMySoda"));
        /// </summary>
        /// <param name="nameOfFuncInLua">The name of the method you want it to be called in Lua</param>
        /// <param name="obj">The base object the method is from</param>
        /// <param name="function">The method</param>
        public void Register(string nameOfFuncInLua, object obj, System.Reflection.MethodBase function)
        {
            luaVM.RegisterFunction(nameOfFuncInLua, obj, function);
        }
    }
}
